import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

import Layout from '../views/layout/Layout'


export const constantRouterMap = [{
    path: '/404',
    component: () =>
      import('@/views/404'),
    hidden: true
  },
  {
    path: '/login',
    component: () =>
      import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    redirect: '/website',
    hidden: true,
    children: [{
        name: 'home',
        meta: {
          title: '后台首页',
          icon: 'home'
        },
        path: 'home',
        component: () =>
          import('@/views/home/index')
      },
      {
        name:'message',
        path:'message',
        component: () => import('@/views/message/mesageList')
      }
    ]
  },
  {
    path: '/',
    component: Layout,
    redirect: '/website',
    children: [{
      path: 'website',
      name: 'website',
      meta: {
        icon: 'STATISTICS',
        title: '基础信息'
      },
      component: () =>
        import('@/views/settings/website/index.vue')
    }]
  },
  {
    path: '/',
    meta: {
      icon: 'home',
      title: '分类管理'
    },
    hidden: true,
    component: Layout,
    redirect: '/categoryList',
    children: [{
        path: 'categoryEdit',
        name: 'categoryEdit',
        meta: {
          icon: 'home',
          title: '添加分类'
        },
        component: () =>
          import('@/views/category/system/categoryEdit.vue')
      },
      {
        path: 'categoryList',
        name: 'categoryList',
        meta: {
          icon: 'home',
          title: '分类列表'
        },
        component: () =>
          import('@/views/category/system/categoryList.vue')
      },
      {
        path: 'addCategory',
        name: 'addCategory',
        hidden: true,
        meta: {
          icon: 'home',
          title: '添加分类'
        },
        component: () =>
          import('@/views/category/user/categoryEdit.vue')
      },
      {
        path: 'category_list',
        name: 'category_list',
        hidden: true,
        meta: {
          icon: 'home',
          title: '分类列表'
        },
        component: () =>
          import('@/views/category/user/categoryList.vue')
      }
    ]
  },
  {
    path: '/',
    component: Layout,
    redirect: '/articleList',
    hidden: true,
    meta: {
      title: '信息管理',
      icon: 'settings'
    },
    children: [{
      name: 'articleList',
      path: '/articleList',
      component: () =>
        import('@/views/article/articleList'),
      meta: {
        title: '信息列表',
        icon: 'settings'
      },
    }, {
      name: 'addArticle',
      path: '/addArticle',
      component: () =>
        import('@/views/article/articleEdit'),
      meta: {
        title: '添加文章',
        icon: 'settings'
      }
    }]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

export default new Router({
  // mode: 'history', //hash
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRouterMap

})
